import Home from "@/views/Home.jsx";
import {lazy} from "react";
import {withKeepAlive} from "keepalive-react-component";


const routes = [
    {
        path: '/',
        name: 'home',
        component: withKeepAlive(Home,{cacheId:'home',scroll:true}),
        meta: {
            title: 'WebApp'
        }
    },{
    path: '/detail/:id',
        name: 'detail',
        component: lazy(() => import('@/views/Detail.jsx')),
        meta: {
            title: 'WebApp-新闻详情'
        }
    },
    {
        path:'/personal',
        name:'personal',
        component: lazy(() => import('@/views/Personal.jsx')),
        meta: {
            title: 'WebApp-个人中心',
            auth: true
        }
    },
    {
        path: '/update',
        name:'update',
        component: lazy(() => import('@/views/Update.jsx')),
        meta: {
            title: 'WebApp-修改个人信息',
            auth: true
        }
    },
    {
        path:'/store',
        name:'store',
        component: lazy(() => import('@/views/Store.jsx')),
        meta: {
            title: 'WebApp-我的收藏',
            auth: true
        }

    },
    {
        path:'/login',
        name:'login',
        component: lazy(() => import('@/views/Login.jsx')),
        meta: {
            title: 'WebApp-登录'
        }
    },
    {
        path:'*',
        name:'404',
        component: lazy(() => import('@/views/Page404.jsx')),
        meta: {
            title: 'WebApp-404'
        }
    }
]

export default routes